package com.okaixz.client.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.okaixz.client.model.domain.ShareInfo;
import com.okaixz.client.model.domain.User;
import com.okaixz.client.model.dto.ShareInfoDto;
import com.okaixz.client.model.dto.UserDto;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author cdz
 * @since 2024-11-10
 */
public interface IShareInfoService extends IService<ShareInfo> {

    /**
     * 保存分享信息
     * @param user
     * @param shareUserId
     * @return
     */
    ShareInfo saveShareInfo(User user, String shareUserId);

    /**
     * 根据邀请人用户id 查询分享信息
     * @param userId
     * @return
     */
    List<ShareInfoDto> getListByUserId(String userId);

    /**
     * 提交邀请码
     * @param userId
     * @param code
     * @return
     */
    @Transactional
    UserDto submit(String userId, String code);
    /**
     * 根据被邀请用户id查询分享信息
     * @param userId
     * @return
     */
    ShareInfo getShareInfoByInviteUserId(String userId);

}
